package com.sinosoft.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Random;

/**
 * @Author: WangShengJie
 * @Date: 2025/4/9
 */
public class UtilsCollection {

    /**
     * 生成电子投保单号
     *
     * @return
     */
    public static String createPtrNo() {
        String prtNo = "";

        Calendar now = Calendar.getInstance();
        SimpleDateFormat dfeform = new SimpleDateFormat("yyyyMMdd");
        String requestDate = dfeform.format(now.getTime());


        prtNo = "30" +requestDate + "AAAAA";

        prtNo += String.format("%03d", now.get(Calendar.MILLISECOND)) + randomNo(4);
        return prtNo;
    }

    public static String randomNo(int length){
        Random random = new Random();
        int s = random.nextInt((int) Math.pow(10,length));
        return String.format("%0"+length+"d",s);
    }

    public static void main(String[] args) {
//        createPtrNo();
        Object o = "";
        checkIsNullOrEmpty(o);
    }

    public static boolean checkIsNullOrEmpty(Object obj) {
        if (obj instanceof String) {
            System.out.println("------");
            return (obj == null || (((String) obj).equals("")) || (((String) obj).equals("null")) || ((String) obj).equals("undefined"));
        } else {
            return obj == null;
        }
    }

}
